package com.base.game.physics;

import com.base.engine.graphics.Vertex3f;

public class BoundingBox {
	private float minX, maxX;
	private float minY, maxY;
	private float minZ, maxZ;

	public float getMinX() {
		return minX;
	}

	public void setMinX(float minX) {
		this.minX = minX;
	}

	public float getMaxX() {
		return maxX;
	}

	public void setMaxX(float maxX) {
		this.maxX = maxX;
	}

	public float getMinY() {
		return minY;
	}

	public void setMinY(float minY) {
		this.minY = minY;
	}

	public float getMaxY() {
		return maxY;
	}

	public void setMaxY(float maxY) {
		this.maxY = maxY;
	}

	public float getMinZ() {
		return minZ;
	}

	public void setMinZ(float minZ) {
		this.minZ = minZ;
	}

	public float getMaxZ() {
		return maxZ;
	}

	public void setMaxZ(float maxZ) {
		this.maxZ = maxZ;
	}

	public BoundingBox(float x, float y, float z, float w, float h, float d) {
		this.setMinX(x);
		this.setMinY(y);
		this.setMinZ(z);
		this.setMaxX(x + w);
		this.setMaxY(y + h);
		this.setMaxZ(z + d);
	}

	public boolean isVecInXBounds(Vertex3f vector){
		return vector.getX() > this.minX && vector.getX() < this.maxX; 
	}
	
	public boolean isVecInYBounds(Vertex3f vector){
		return vector.getY() > this.minY && vector.getY() < this.maxY; 
	}
	
	public boolean isVecInZBounds(Vertex3f vector){
		return vector.getZ() > this.minZ && vector.getZ() < this.maxZ; 
	}
	
    public boolean isVecInside(Vertex3f vector)
    {
        return this.isVecInXBounds(vector) ? (this.isVecInYBounds(vector) ? this.isVecInZBounds(vector) : false) : false;
    }
    
	public boolean isVecInsideYZBounds(Vertex3f vector)
    {
        return vector == null ? false : this.isVecInYBounds(vector) && this.isVecInZBounds(vector);
    }

	public boolean isVecInsideXZBounds(Vertex3f vector)
    {
        return vector == null ? false : this.isVecInXBounds(vector) && this.isVecInZBounds(vector);
    }

	public boolean isVecInsideXYBounds(Vertex3f vector)
    {
        return vector == null ? false : this.isVecInXBounds(vector) && this.isVecInYBounds(vector);
    }
}